package com.bmps.springcloud.insuredmicroservice.service.underwrite.strategy.minordeath.riskstrategy;

import com.bmps.springcloud.insuredmicroservice.model.accept.LcPolModel;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.List;

/**
 * description:
 * LBU020
 *
 * @author jackdaw
 * @date 2020-01-07 17:22
 */
@Component
public class Lbu020RiskStrategy implements RiskStrategy {
    @Override
    public BigDecimal getAmount(LcPolModel lcPolModel, List<LcPolModel> lcPolModels, boolean current) {

        return current ? lcPolModel.getAmnt() : (lcPolModel.getAccountValue().compareTo(lcPolModel.getAmnt()) == 1 ?
                lcPolModel.getAccountValue() : lcPolModel.getAmnt());
        //该险种在账户价值计算的时做了处理,账户价值和保额取最大的。
        //return current ? lcPolModel.getAmnt() : lcPolModel.getAccountValue();
    }
}
